package com.kongxx.struts2study.jfreechart.web.action;

import com.opensymphony.xwork2.ActionSupport;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.JFreeChart;
import org.jfree.data.general.DefaultPieDataset;

public class MyPieChart1Action extends ActionSupport {
	
	private JFreeChart chart;

	public String execute() throws Exception {
		DefaultPieDataset data = new DefaultPieDataset();
		data.setValue("D1", 44.00D);
		data.setValue("D2", 12.00D);
		data.setValue("D3", 22.00D);
		data.setValue("D4", 22.00D);
		chart = ChartFactory.createPieChart("Pie Chart", data, true, true, false);
		return SUCCESS;
	}

	public JFreeChart getChart() {
		return chart;
	}

	public void setChart(JFreeChart chart) {
		this.chart = chart;
	}
}
